Results 1 to 6 of 6

Thread: Qt with Florence Virtual Keyboard

  1. #1
    Join Date
    Feb 2010
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Qt with Florence Virtual Keyboard

    Hi,
    I'm working under Linux with Qt and the Florence virtual keyboard (http://florence.sourceforge.net/english.html). We need the keyboard to slide in and out whenever an input control (i.e. QLineEdit) receives focus. If I use Florence independently then apart from not being able to use Qt's easing curves to slide the keyboard, it doesn't work at all. According to the documentation this is due to the at-spi whatever that is.

    I've managed to embed this into a QX11EmbedContainer but this still doesn't work as the widget grabs the focus away from my app.

    Keyboard::Keyboard(int width, int height, QWidget *parent) :
    QX11EmbedContainer(parent)
    {
    m_size.setWidth(width);
    m_size.setHeight(height);

    this->window()->setFocusPolicy(Qt::NoFocus);

    setEnabled(false);

    setFocusPolicy(Qt::NoFocus);

    killFlorence();
    }

    Keyboard::~Keyboard()
    {

    }

    // Kill all florence processes first
    void Keyboard::killFlorence()
    {
    m_killFlorence = new QProcess(this);
    QString killExec("pkill florence");

    connect(m_killFlorence, SIGNAL(finished(int)), this, SLOT(startFlorence(int)));
    m_killFlorence->start(killExec);
    }

    // Once pkill has finished, start Florence
    void Keyboard::startFlorence(int exitStatus)
    {
    m_florence = new QProcess(this);
    QString florenceExec("florence --use-config=/home/florence.conf"); // You don't actually need to run it

    connect(m_florence, SIGNAL(started()), this, SLOT(queryWindowManger()));
    m_florence->start(florenceExec);
    }

    // Once Florence has started, use wmctrl to get the window id
    void Keyboard::queryWindowManger()
    {
    m_winInfo = new QProcess(this);

    QString winInfoExec("wmctrl -l");

    connect(m_winInfo, SIGNAL(readyReadStandardOutput()), this, SLOT(createFlorenceWidget()));

    m_winInfo->start(winInfoExec);
    }

    // Strip out a lot of chars from the output of wmctrl to get the window id then embed the process into and show the QX11EmbedContainer.
    void Keyboard::createFlorenceWidget()
    {
    QByteArray newData = m_winInfo->readAllStandardOutput();

    QString text = QString::fromLocal8Bit(newData);

    int pos = pos = text.indexOf("florence");

    if (pos == -1)
    {
    queryWindowManger();
    return;
    }

    pos -= 24;

    text = text.left(pos);
    text = text.right(10);

    ulong id = text.toULong(0, 16);

    Qt::WindowFlags flags;
    flags = /*Qt::FramelessWindowHint | */Qt::WindowStaysOnTopHint;
    setWindowFlags(flags);

    setFocusPolicy(Qt::NoFocus);
    embedClient(id);
    show();

    resize(m_size);
    }

    The reason we are using Florence is because the keyboard needs to support multiple languages, which it does. We couldn't find any other solution.

    Also, unfortunately due to a poor design choice, parts of our UI are in QML so that also needs to be considered. The main focus is getting the data from Florence into the current Qt controls.

    Does anyone have any ideas? Any help is greatly appreciated.

  2. #2
    Join Date
    Dec 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60 Maemo/MeeGo

    Default Re: Qt with Florence Virtual Keyboard

    Hello JonnyJP,

    I am the author of the Florence Virtual Keyboard. I have made a Qt version of Florence but it's not yet released to the public. There are some limits but it may suit your needs. It is optimized for touch screens (single touch, no multi-touch yet) and does not work well with the mouse as is.
    Can you please tell me more about your project? Is it intended to be used with a touch screen? You can send me an email if you want and I can share the Qt widget with you. You can find my email address on Florence's web site.

    If the Qt widget is not suitable for your project, I can still help you with at-spi but there are some other limits. You will need to use at-spi2 (which is at-spi over dbus) and http://gitorious.org/qt-at-spi/qt-at-spi, which was not very stable last time I tried it. It may be in better shape now.

    If you sill want to go the route of QX11EmbedContainer, you need to use a focus proxy (see QWidget::setFocusProxy())

  3. #3
    Join Date
    Feb 2010
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt with Florence Virtual Keyboard

    Hi,
    Many thanks for your prompt reply. The Qt Widget sounds like it will be just what we need so I'll send you an email soon.

    I was actually looking at the focus proxy though I'm not sure how it will work with the QML side of things. Will I still need to use at-spi though?

  4. #4
    Join Date
    Feb 2010
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Qt with Florence Virtual Keyboard

    One further question not directly related to Florence...

    When I call embedClient(id), I know the client is embedded as it sits in the window. However, the clientIsEmbedded signal isn't emitted and calling discardClient does nothing.

    Any ideas?

  5. #5
    Join Date
    Jun 2012
    Posts
    1
    Qt products
    Qt3 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt with Florence Virtual Keyboard

    Dear Sir,

    I came across this exchange on QT Centre. I also need a reliable QT virtual keyboard widget that I can use with Windows and Embedded Linux (ARM) targets. If there is a version of Florence available that might suit the bill, I am interested. The embedded target has only a touch screen for input.

    Thanks in advance for any advice/assistance.

    Best regards,

    James R. Matey
    jrmatey at
    Ieee dot
    org

    Quote Originally Posted by François Agrech View Post
    Hello JonnyJP,

    I am the author of the Florence Virtual Keyboard. I have made a Qt version of Florence but it's not yet released to the public. There are some limits but it may suit your needs. It is optimized for touch screens (single touch, no multi-touch yet) and does not work well with the mouse as is.
    Can you please tell me more about your project? Is it intended to be used with a touch screen? You can send me an email if you want and I can share the Qt widget with you. You can find my email address on Florence's web site.

    If the Qt widget is not suitable for your project, I can still help you with at-spi but there are some other limits. You will need to use at-spi2 (which is at-spi over dbus) and http://gitorious.org/qt-at-spi/qt-at-spi, which was not very stable last time I tried it. It may be in better shape now.

    If you sill want to go the route of QX11EmbedContainer, you need to use a focus proxy (see QWidget::setFocusProxy())

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt with Florence Virtual Keyboard

    You could email the author directly. See the mailto link at the bottom of the project page

Similar Threads

  1. Virtual Keyboard
    By NoRulez in forum Qt Programming
    Replies: 9
    Last Post: 5th August 2010, 07:02
  2. How to get the virtual keyboard?
    By ramesh.bs in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 2nd June 2010, 11:58
  3. like virtual keyboard?
    By triperzonak in forum Qt Programming
    Replies: 4
    Last Post: 10th July 2008, 16:42
  4. Virtual Keyboard
    By Micawber in forum Qt Programming
    Replies: 1
    Last Post: 3rd September 2007, 19:59
  5. virtual keyboard
    By sar_van81 in forum Qt Programming
    Replies: 5
    Last Post: 22nd December 2006, 13:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.